"use strict"

/**
 * 邢台市政府采购网爬虫
 *  
 */

var Base = require("./base");
var xt_spider = new Base();
xt_spider.name = "邢台市政府采购网";
xt_spider.encode = "GBK";

xt_spider.getPageUrl = function (pg) {
    var url = "http://www.xingtai.gov.cn/zwgk/zwzt/zfcg/zbgg/index_" + (pg - 1) + ".html";
    if (pg == 1) {
        url = "http://www.xingtai.gov.cn/zwgk/zwzt/zfcg/zbgg/index.html";
    };
    return url;
};

xt_spider.getItems = function ($) {
    var items = [];
    $(".bot_xhx a").each(function (index, ele) {
        var e = $(ele);
        var item = {};
        item.title = e.attr("title");
        item.url = "http://www.xingtai.gov.cn/zwgk/zwzt/zfcg/zbgg" + e.attr("href").substring(1);
        item.source = xt_spider.name;
        items.push(item);
    });
    return items;
};

exports = module.exports = xt_spider;